Skip to content

fix(job): make job timeout configurable via request param (backport to master)#556

Open
regdocs wants to merge 1 commit into
masterfrom
backport-configurable-job-timeout
Open

fix(job): make job timeout configurable via request param (backport to master)#556
regdocs wants to merge 1 commit into
masterfrom
backport-configurable-job-timeout

Conversation

@regdocs

@regdocs regdocs commented Jul 1, 2026

Copy link
Copy Markdown
Member

Backport

Backports the configurable job-timeout feature from develop (commit f06c9a9, "fix(job): Make job timeout configurable so that job can pass as param") onto master.

Why

The @job decorator in agent/job.py hardcoded the RQ job_timeout to 4 * 3600 (4h) for every job. Long-running jobs — notably the new streaming offsite backup flow — were SIGKILLed by the RQ work-horse exactly 4h in, even though the endpoint (Press) requests a longer timeout (e.g. 18000s). The requested value was never consumed by the agent.

What changed

agent/job.py only:

  • job(...) gains an optional timeout param.
  • The decorator reads agent_job_timeout from the request JSON body when present.
  • Resolves the effective timeout as: agent_job_timeout → decorator timeoutServer().config["job_timeout"]DEFAULT_TIMEOUT (4h), clamped to [0, 24h].
  • enqueue_call now uses the resolved value instead of the hardcoded 4 * 3600.

No web.py changes are needed — the decorator reads the timeout generically, so all endpoints (including /backup) benefit.

Notes

  • This is a faithful backport of the develop behavior; the string-coercion hardening discussed separately was omitted since agent_job_timeout is always sent as a number.
  • Fixes the 4h streaming-backup kill once deployed to servers running master.

Backport of the configurable job-timeout feature from develop (f06c9a9).
The @job decorator hardcoded the RQ job_timeout to 4h, so long-running
jobs (e.g. streaming offsite backups) were SIGKILLed at 4h regardless of
the timeout the endpoint requested. Read agent_job_timeout from the
request body and thread it into enqueue_call, falling back to the
configured job_timeout and then the 4h default.
@mergify

mergify Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant